<?php


namespace app\admin\service;


use app\common\model\Users as UsersModel;
use app\common\validate\Users;
use app\traits\Result;
use think\exception\ValidateException;

class UserService
{
    use Result;

    /**
     * 编辑用户信息
     */
    public static function storeModel($data,$scene){
        try {
            validate(Users::class)->scene($scene)->check($data);
        } catch (ValidateException $e) {
            return Result::error( $e->getError());
        }
        $model = new UsersModel();
        $model->exists(true)->update($data);
        return Result::success('编辑成功');
    }
}